package com.example.myui.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.myui.R;

import java.util.List;

/**
 * Created by Administrator on 2018/1/2/002.
 */

public class SelectorAdapterYear extends BaseQuickAdapter<String, BaseViewHolder> {
    private Context mContext;
    private yearListener mYearListener;

    public SelectorAdapterYear(Context context, @Nullable List<String> data) {
        super(R.layout.item_text_left, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item) {
        holder.setText(R.id.tv_content, item);
        TextView context = holder.getView(R.id.tv_content);
        context.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mYearListener != null) {
                    mYearListener.onYeahClickListener(item);
                }
            }
        });
    }

    public interface yearListener {
        void onYeahClickListener(String yeah);
    }

    public void setmYearListener(yearListener mYearListener) {
        this.mYearListener = mYearListener;
    }
}

